# Quick Work Log by Ruby
#
# This is a simple ruby script for work log. It saves your log in a file.
# Based on idea invent by Joshua Fitzgerald, 7/2005.
# -----------------------------------------------------------------------
# version 0.1
# author Jack 8/8/2006
# 
# only adds basic log utilities.
#

#== Imports 
require "date"
require "date/format"
#== The configs are set here, will find a better way by next version.
logFileName = "C:\\Documents and Settings\\neusoft\\My Documents\\Worklog\\worklog.log"
logFile = File.new(logFileName, "a")

#Logs are better if can be organized by categores,
categories = ["work", "relex", "study", "plan", "play"]

#== Input the category num to choose category, so you can't misspell it.
puts "Input the category list below:"
count = 1
categories.each{ |category|
  puts "#{count}. #{category}"
  count += 1
}
index = gets.to_i

#Default category are relex.
category = "relex"
if((1..categories.length) === index)
  category = categories[index - 1]
end

puts "Input the log message below."
logFile.write "#{DateTime::now} - <#{category}> - #{gets}"